import request from "@/utils/request";
import type {
    schoolInfoData,
    schoolListFormData,
    schoolResponseData,
    schoolAllResponseData,
    schoolListResponseData
} from "./type"

enum API{
    SCHOOL_ALL_URL="/manage/school/all",
    SCHOOL_LIST_URL = "/manage/school/list",  //筛选项
    SCHOOL_ADD_URL = "/manage/school/add",  //添加项
    SCHOOL_GET_ID_URL="/manage/school/find", //获取id
    SCHOOL_UPDATE_URL="/manage/school/update", //修改
    SCHOOL_DELETE_URL= "/manage/school/delete"
}
    export const reqSchoolAll = ()=>
    request.get<any,schoolAllResponseData>(API.SCHOOL_ALL_URL)
    // 读筛选项
    export const reqSchoolList = (data:schoolListFormData)=>
    request.post<any,schoolListResponseData>(API.SCHOOL_LIST_URL,data)
     // 添加
    export const reqSchoolAdd = (data:schoolInfoData)=>
    request.post<any,schoolResponseData>(API.SCHOOL_ADD_URL,data)
  
    //修改
    export const reqSchoolById = (_id:string)=>
    request.get<any,schoolResponseData>(API.SCHOOL_GET_ID_URL+`?_id=${_id}`)

    export const reqSchoolUpdata = (data:schoolInfoData)=>
    request.post<any,schoolResponseData>(API.SCHOOL_UPDATE_URL,data)
     // 删除
    export const reqSchoolDelete = (schoolId:string)=>
    request.post<any,schoolResponseData>(API.SCHOOL_DELETE_URL,{schoolId})